Ext.define('DragonApp.view.channel.Channel', {
    extend: 'DragonApp.view.foundation.Grid',

    alias: ['widget.channelpanel'],

    requires: [
        'DragonApp.view.channel.ChannelForm',
        'DragonApp.view.channel.ChannelController'
    ],
    store: {
        type: 'jsonPChannelStore',
        storeId : 'jsonPChannelStore'
    },

    controller: 'channel',

    columns: [
        { text: 'ID', dataIndex: 'id', width: 100 },
        { text: '渠道编号', dataIndex: 'cid', width: 100 },
        { text: '渠道名称', dataIndex: 'cname', width: 100 },
        { text: '渠道状态', dataIndex: 'status', width: 100, renderer: 'activeStatusRender' },
        { text: '备注', dataIndex: 'comments', flex: 1 }
    ],

    initComponent: function() {
        var me = this;
        me.tbar = ['->',
            {
                xtype: 'button',
                text: '新建',
                itemId: 'new',
                tooltip: 'New',
                handler: 'onAdd',
                glyph: 'xf234@FontAwesome',
                width: 100
            }, {
                xtype: 'button',
                text: '刷新',
                tooltip: 'Refresh',
                handler: 'onRefresh',
                glyph: 'xf021@FontAwesome',
                width: 100
            }
        ];
        me.callParent(arguments);
        //========
        //权限控制
        //========
        if ('系统用户' == sessionStorage.getItem("DragonApp_role_name")) {

            me.queryById('edit').hide();
            me.queryById('delete').hide();

            me.queryById('new').setDisabled(true);
        }
    }
});